import { http } from "@/utils/http";
import { getToken175 } from "@/utils/token";

type Result = {
  message: string;
  data: any;
  code: number;
};

// 为task API添加Authorization头的辅助函数
const taskRequest = <T>(method: string, url: string, data?: object) => {
  const token = getToken175(); // 每次调用都获取最新的token
  return http.request<T>(method as any, url, {
    data,
    headers: {
      Authorization: token ? `Bearer ${token}` : undefined,
    },
  });
};

// 这里可以添加相关的API接口
// 例如：
// export const getDataPushList = (data?: object) => {
//   return taskRequest<Result>("post", "/api/data/push/list", { data });
// };
